# def sin():
#     print('举头望明月，低头思故乡')
# sin()
#
#
#
#
# def add():
#     a = 3
#     b = 5
#     s = a+b
#
#
#
#
# def add(a, b):   # a.b为形参
#     print(a + b)
#
#
# add(1,3)#实参为常量
# #第二组
# a = 1
# b = 3
# add(a, b)#实参为变量
#
#
# add(2*4, 4*5)
#
# c=3
# add(8,c*3)
#
# def score(a, b, c):
#     print('1成绩为：',a)
#     print('2成绩为：', b)
#     print('3成绩为：', c)
#
#
# score(65,85,89)
# score(b=65,a=85,c=89)
#
# def reg(name,age,sex='女'):
#     print('姓名{} 年龄{} 性别{}')
#
# reg('张三',20)
# reg('李四',21,'男')


#
# def favf(*fru):
#     print("我喜欢的水果")
#     for i in fru:
#         print(i)
# favf("苹果")
# favf("苹果","梨")
#


# 参数的值大于等于2，如果声明函数的时候有其他形参通常把可变长参数放最后
# def show(a,b,*l):
#     print(a)
#     print(b)
#     print(l)
#
#
# show(1,2,3,4,5,69)
#
#
#
#
# def re(a,b,c,d):
#     return a+b ,c*d ,a-c
#
#
# ss = re(1,2,3,4)
# print(ss)


# #变量的作用域
# def fun():
#     a=20
#     return a
# a=10
# print(a)
# print(fun())
# #代码3
# def add(a,b):
#     c=a+b
#     return c, a,b,a*b,a-b
# d= add(1,2)
# print(d)


# 递归函数算阶乘
# def f(n):
#     if n <= 1:
#         return 1
#     else:
#         return n * f(n - 1)
#
#
# num = int(input("请输入"))
# s = f(num)
# print(num, "的阶乘是", s)

# 递归求和
# def sum(n):
#     if n == 1:
#         return 1
#     else:
#         return n + sum(n - 1)
#
#
# print("1到100的和为", sum(100))
#
#
# #  计算斐波那契数列
# def fibo(n):
#     if n <= 2:
#         return 1
#     else:
#         return fibo(n - 1) + fibo(n - 2)
#
#
# print("斐波那契数列的第{}项为{}", format(7, fibo(7)))

#   匿名函数lambda
# 实现a+b+c
sum = lambda a, b, c: a + b + c
print(sum(1, 2, 3))

# 编写lambda参数为边长求面积
fun = lambda m: m ** 2
print(fun(5))